//
//  MDMusementController.swift
//  麦兜直播
//
//  Created by Apple on 16/10/18.
//  Copyright © 2016年 yeqingyu. All rights reserved.
//

import UIKit

private let headViewH:CGFloat = 150

class MDMusementController: MDBaseRoomController {
    fileprivate lazy var musementNetTool:MDMusementNetTool = MDMusementNetTool()
    fileprivate lazy var headView:MDMusementHeadView = {
    let headView = MDMusementHeadView.show()
        headView.frame = CGRect(x: 0, y: -headViewH, width: screenWidth, height: headViewH)
        return headView
    }()
    override func viewDidLoad() {
        super.viewDidLoad()
           setUpUI()
           requestData()
    }
}



extension MDMusementController{
  
    override func setUpUI() {
        super.setUpUI()
        collectionView.addSubview(headView)
        collectionView.contentInset = UIEdgeInsets(top:headViewH, left: 0, bottom:0, right: 0)
    }

      override func requestData() {
        baseNetTool = musementNetTool
        musementNetTool.reuestData {
            self.stopAnimation()
            self.collectionView.reloadData()
            var muses = self.musementNetTool.baseRoomGroup
            muses.removeFirst()
            self.headView.musmes = muses
        }
    }
}
